<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="/WEB-INF/template/common/taglibs.jspf" %>
<es:contentHeader/>

<t:base type="jquery,jquery-ui-bootstrap:bootstrap,jquery-ui-bootstrap:jquery-ui,query-ui-bootstrap:jquery.layout,jquery-ui-bootstrap:font-awesome"></t:base>
<t:base type="jquery-ui-bootstrap:jquery.blockUI,jquery-ui-bootstrap:bootstrap.file-input,bootstrap-datetimepicker,nicescroll,jqueryValidate,application,common,datePicker"></t:base>


<style type="text/css">
    .error{
        color:red;
    }
</style>

<div class="panel">
    <ul class="nav nav-tabs">
        <shiro:hasPermission name="sys:user:create">
            <c:if test="${op eq '新增'}">
                <li ${op eq '新增' ? 'class="active"' : ''}>
                    <a href="<%=request.getContextPath()%>/admin/bookingContainer/create">
                        <i class="icon-file-alt"></i>
                        新增
                    </a>
                </li>
            </c:if>
        </shiro:hasPermission>

        <c:if test="${not empty m.id}">
            <li ${op eq '查看' ? 'class="active"' : ''}>
                <a href="<%=request.getContextPath()%>/admin/bookingContainer/${m.id}">
                    <i class="icon-eye-open"></i>
                    查看
                </a>
            </li>
            <shiro:hasPermission name="sys:user:update">
                <li ${op eq '修改' ? 'class="active"' : ''}>
                    <a href="<%=request.getContextPath()%>/admin/bookingContainer/${m.id}/update">
                        <i class="icon-edit"></i>
                        修改
                    </a>
                </li>
            </shiro:hasPermission>
            <shiro:hasPermission name="sys:user:delete">
                <li ${op eq '删除' ? 'class="active"' : ''}>
                    <a href="<%=request.getContextPath()%>/admin/bookingContainer/${m.id}/delete">
                        <i class="icon-trash"></i>
                        删除
                    </a>
                </li>
            </shiro:hasPermission>
        </c:if>
    </ul>

    <form:form id="editForm" method="post" commandName="m" cssClass="form-inline form-horizontal form-small">
        <es:showGlobalError commandName="m"/>
        <form:hidden path="id"/>
        <div id="baseinfo">
            <h4 class="hr">订舱申请</h4>

            <div class="control-group span4">
                <form:label path="saleOrderCode" cssClass="control-label">销售订单号</form:label>
                <div class="controls inline-radio">
                        <form:input path="saleOrderCode" readonly="true"/>
                </div>
            </div>

            <div class="control-group span4">
                <form:label path="bookingTime" cssClass="control-label">预定船期</form:label>
                <div class="controls inline-radio">
                    <input type="text"  name="bookingTime"  value="<fmt:formatDate value='${m.bookingTime}'  type='date' pattern='yyyy-MM-dd hh:mm:ss'/>" onclick="wdate()"/>
                </div>
            </div>


            <div class="control-group span4">
                <form:label path="containerCount_HQ" cssClass="control-label">HQ集装箱数量</form:label>
                <div class="controls inline-radio">
                    <form:input path="containerCount_HQ" placeholder=""/>
                </div>
            </div>

            <div class="control-group span4">
                <form:label path="containerCount_EQ" cssClass="control-label">EQ集装箱数量</form:label>
                <div class="controls inline-radio">
                    <form:input path="containerCount_EQ" placeholder=""/>
                </div>
            </div>

            <div class="control-group span4">
                <form:label path="billOfLadingCode" cssClass="control-label">提单号</form:label>
                <div class="controls">
                    <form:input path="billOfLadingCode" placeholder=""/>
                </div>
            </div>

            <div class="control-group span4">
                <form:label path="shipVoyage" cssClass="control-label">船名/航次</form:label>
                <div class="controls">
                    <form:input path="shipVoyage" placeholder=""/>
                </div>
            </div>

            <div class="control-group span4">
                <form:label path="shipDate" cssClass="control-label">实际船期</form:label>
                <div class="controls">
                    <%--<form:input path="shipdate" placeholder=""/>--%>
                    <input type="text"  name="shipDate"  value="<fmt:formatDate value='${m.shipDate}'  type='date' pattern='yyyy-MM-dd hh:mm:ss'/>" onclick="wdate()"/>
                </div>
            </div>

            <div class="control-group span4">
                <form:label path="finalCustoms" cssClass="control-label">截港日期</form:label>
                <div class="controls">
                    <%--<form:input path="finalcustoms"/>--%>
                    <input type="text"  name="finalCustoms"  value="<fmt:formatDate value='${m.finalCustoms}'  type='date' pattern='yyyy-MM-dd hh:mm:ss'/>" onclick="wdate()"/>
                </div>
            </div>

            <div class="control-group span4">
                <form:label path="confirmBillDate" cssClass="control-label">截单日期</form:label>
                <div class="controls">
                    <%--<form:input path="confirmbilldate"/>--%>
                    <input type="text"  name="confirmBillDate"  value="<fmt:formatDate value='${m.confirmBillDate}'  type='date' pattern='yyyy-MM-dd hh:mm:ss'/>" onclick="wdate()"/>

                </div>
            </div>

            <div class="control-group span4">
                <form:label path="station" cssClass="control-label">场站</form:label>
                <div class="controls">
                    <form:input path="station"/>
                </div>
            </div>

            <div class="control-group span4">
                <form:label path="stationLinkMan" cssClass="control-label">场站联系人</form:label>
                <div class="controls inline-radio">
                    <form:input path="stationLinkMan"/>
                </div>
            </div>


            <div class="control-group span4">
                <form:label path="stationLinkManTel" cssClass="control-label">场站联系人电话</form:label>
                <div class="controls inline-radio">
                    <form:input path="stationLinkManTel"/>
                </div>
            </div>

            <div class="control-group span4">
                <form:label path="remark" cssClass="control-label">备注</form:label>
                <div class="controls inline-radio">
                    <%--<input type="text" name="remark" value="${remark}">--%>
                    <textarea name="remark">${m.remark}</textarea>
                </div>
            </div>




        </div>


        <c:if test="${op eq '新增'}">
            <c:set var="icon" value="icon-file-alt"/>
        </c:if>
        <c:if test="${op eq '修改'}">
            <c:set var="icon" value="icon-edit"/>
        </c:if>
        <c:if test="${op eq '删除'}">
            <c:set var="icon" value="icon-trash"/>
        </c:if>

        <div class="control-group left-group">
            <div>
                <button type="submit" id="sub" class="btn btn-primary">
                    <i class="${icon}"></i>
                        ${op}
                </button>
                <a href="javascript:self.location=document.referrer;" class="btn">
                    <i class="icon-reply"></i>
                    返回
                </a>
            </div>
        </div>
    </form:form>
</div>
<es:contentFooter/>


<script type="text/javascript">


    $(function () {
        $("#editForm").validate({
            rules: {
                bookingTime: {
                    required: true
                },
                containerCount_HQ: {
                    required: true
                },
                billOfLadingCode: {
                    required: true,
                },
                shipvoyage: {
                    required: true,
                    minlength: 5
                },
                shipdate: {
                    required: true
                },
                finalcustoms: {
                    required: true
                }
            },
            messages: {
                bookingTime: {
                    required: "请输入预定船期"
                },
                containerCount_HQ: {
                    required: "请输入集装箱数量"
                },
                billOfLadingCode: {
                    required: "请输入提单号"
                },
                shipvoyage: {
                    required: "船名/航次"
                },
                shipdate: {
                    required: "实际船期不能为空"
                },
                finalcustoms: {
                    required: "请输入您的截港日期"
                }
            }
        });
    });
    $(function () {
        $("#editForm").submit(function () {
            var flag = $("#editForm").valid();
            if (!flag) {
                return false;
            }
        });
    });
</script>